//
//  main.m
//  autocompilerCMD
//
//  Created by Vescky on 13-5-17.
//  Copyright (c) 2013年 Vescky. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MainHandler.h"
#import "cmdUtilities.h"
#import "FileOperator.h"
#import "packagerForIOS.h"
#import "Modify_pbxproj.h"

//#define TEST

int main(int argc, const char * argv[])
{
    @autoreleasepool {
        if (isArgsValid(argc, argv)) {
            printf("\n Welcome to use autoMaker! \nVersion:%s",[CURRENT_VERSION UTF8String]);
            NSMutableDictionary *dict = getArgsDict(argc, argv);
            NSLog(@"%@",dict);
            MainHandler *mh = [[MainHandler alloc] init];
            [mh serialRunWithArgs:dict];
        }
        
//        [Modify_pbxproj readProfile:@"/Users/Vescky/Documents/DOWNLOAD/apps123Test1InHouse.mobileprovision"];
       
#ifdef TEST
        
        const char * argvTest[] = {"-enName","vkTestO2O1020","-mode","0","-ios","/Users/vescky/Desktop/svn_path/iOS7/WIP/android/AppsTemplate","-zipUrl","/temp/402881e84ab8dd4f014abd46aa3d048c.zip","-out","/temp/vkTestWIP0106"};
        
//         const char * argvTest[] = {"-enName","yhDress","-ios","-profile","/Users/Vescky/SVN_Folder/trunk/src/mobile/merchant-app/YuanHe-native/iOS/Certs/yhDressAcHoc.mobileprovision","-zipUrl","file:/Users/Vescky/SVN_Folder/trunk/src/mobile/merchant-app/publish-repo/元禾服饰/402882e53daa0e8f013dc334cd0628c5_402882e53dcf0748013ded8b074e4dcc.zip","--build","-out","/temp/test99"};
       
        NSMutableDictionary *dict = getArgsDict(10, argvTest);
        NSLog(@"%@",dict);
        MainHandler *mh = [[MainHandler alloc] init];
        [mh serialRunWithArgs:dict];
#endif

//        [[FileOperator shareFileOperator] synDownloadZipPackage:@"http://124.172.220.246:8080/downloads/ios/HuiChuang.zip"];
        
}
    
//    MainHandler *mh = [[MainHandler alloc] init];
//    [mh serialRunWithArgs:[[NSMutableDictionary alloc] initWithObjectsAndKeys:
//                           @"runTest2",@"enName",
//                           @"/Users/Vescky/Documents/TestAuto/testAAA",@"out",
////                           @"default",@"ios",
//                           @"default",@"android",
//                           @"YES",@"build",
////                           @"file:/Users/Vescky/SVN_Folder/trunk/src/mobile/merchant-app/publish-repo/金专猎头/402882e5387f27eb01388326f00a0035_402882e53e111312013e11ab9b4420e7.zip",@"zipUrl",
//                           nil]];
//    
//    const char * argvTest[] = {"asdw","-enName","testTTT","-ios","-poiu"};
//    hasInvalidArgs(5,argvTest);
    return 0;
}


